package com.ranjiaqi.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * @ClassName TestIterator
 * @Description TODO
 * @Author hp
 * @Date 2021/6/23 10:35
 * @Version 1.0
 **/
public class TestIterator {
    public static void main(String[] args) {
        Collection<Integer> collection = new ArrayList<Integer>();
        collection.add(1);
        collection.add(2);
        collection.add(3);
        collection.add(4);
        Iterator<Integer> iterator = collection.iterator();
        while (iterator.hasNext()){
            Integer integer = iterator.next();
            System.out.println(integer);
        }

    }
}
